home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / Xconq 7.1.0 / src / xconq-7.1.0 / mpw-configure < prev    next >
Encoding:
Text File  |  1996-07-07  |  10.1 KB  |  324 lines  |  [TEXT/R*ch]

  1. # Configuration script
  2. # Copyright (C) 1994, 1995 Free Software Foundation, Inc.
  3.  
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2 of the License, or
  7. # (at your option) any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program; if not, write to the Free Software
  14. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15.  
  16. ### WARNING
  17. ### This script (and mpw-config.in fragments) must NOT use any 8-bit chars!
  18. ### WARNING
  19.  
  20. # This is an MPW Shell script that sets everything up for compilation,
  21. # mainly creating directories, and editing copies of files.
  22.  
  23. Set savedir "`Directory`"
  24.  
  25. #Set Echo 1
  26.  
  27. Set ThisScript "{0}"
  28.  
  29. Set srcroot "--------"
  30.  
  31. Set srcdir ":"
  32.  
  33. Set objdir ":"
  34.  
  35. Set prefix ":"
  36.  
  37. Set host_alias "m68k-apple-mpw"
  38.  
  39. Set target_alias {host_alias}
  40.  
  41. Set host_cc "mpw-c"
  42.  
  43. Set prefix "{MPW}":Cygnus:latest:
  44.  
  45. Set verify 0
  46. Set verifystr ""
  47.  
  48. # Parse arguments.
  49.  
  50. Loop
  51.     Break If {#} == 0
  52.     If "{1}" =~ /--cc/
  53.         Set host_cc "{2}"
  54.         Shift 1
  55.     Else If "{1}" =~ /--host/
  56.         Set host_alias "{2}"
  57.         Shift 1
  58.     Else If "{1}" =~ /--prefix/
  59.         Set prefix "{2}"
  60.         Shift 1
  61.     Else If "{1}" =~ /--srcdir/
  62.         Set srcdir "{2}"
  63.         Shift 1
  64.     Else If "{1}" =~ /--srcroot/
  65.         Set srcroot "{2}"
  66.         Shift 1
  67.     Else If "{1}" =~ /--target/
  68.         Set target_alias "{2}"
  69.         Shift 1
  70.     Else If "{1}" =~ /-v/
  71.         Set verify 1
  72.         Set verifystr "-v"
  73.         Shift 1
  74.     Else
  75.         Echo "{1}" is not a valid argument
  76.         Exit 1
  77.     End If
  78.     Shift 1
  79. End Loop
  80.  
  81. Set Exit 0
  82.  
  83. # (should interpret aliases if not in canonical form)
  84.  
  85. Set host_canonical "{host_alias}"
  86.  
  87. Set target_canonical "{target_alias}"
  88.  
  89. # Point to the correct set of tools to use with the chosen compiler.
  90.  
  91. If "{host_cc}" =~ /mpw-c/
  92.     Set cc_name '{CC_MPW_C}'
  93.     Set segment_flag '-s {Default}'
  94.     Set ar_name '{AR_LIB}'
  95.     Set ranlib_name '{RANLIB_NULL}'
  96.     Set cc_ld_name '{CC_LD_LINK}'
  97.     Set prog_ext_name '{PROG_EXT_68K}'
  98.     Set extralibs_name '{EXTRALIBS_C}'
  99.     Set makepef_name '{MAKEPEF_NULL}'
  100.     Set rez_name '{REZ_68K}'
  101. Else If "{host_cc}" =~ /sc/
  102.     Set cc_name '{CC_SC}'
  103.     Set segment_flag '-s {Default}'
  104.     Set ar_name '{AR_LIB}'
  105.     Set ranlib_name '{RANLIB_NULL}'
  106.     Set cc_ld_name '{CC_LD_LINK}'
  107.     Set prog_ext_name '{PROG_EXT_68K}'
  108.     Set extralibs_name '{EXTRALIBS_C}'
  109.     Set makepef_name '{MAKEPEF_NULL}'
  110.     Set rez_name '{REZ_68K}'
  111. Else If "{host_cc}" =~ /mwc68k/
  112.     Set cc_name '{CC_MWC68K}'
  113.     Set segment_flag '-s {Default}'
  114.     Set ar_name '{AR_MWLINK68K}'
  115.     Set ranlib_name '{RANLIB_NULL}'
  116.     Set cc_ld_name '{CC_LD_MWLINK68K}'
  117.     Set prog_ext_name '{PROG_EXT_68K}'
  118.     Set extralibs_name '{EXTRALIBS_C}'
  119.     Set makepef_name '{MAKEPEF_NULL}'
  120.     Set rez_name '{REZ_PPC}'
  121. Else If "{host_cc}" =~ /m68k-gcc/
  122.     Set cc_name '{CC_68K_GCC}'
  123.     Set segment_flag '-s {Default}'
  124.     Set ar_name '{AR_68K_AR}'
  125.     Set ranlib_name '{RANLIB_RANLIB}'
  126.     Set cc_ld_name '{CC_68K_GCC}'
  127.     Set prog_ext_name '{PROG_EXT_68K}'
  128.     Set extralibs_name '{EXTRALIBS_C}'
  129.     Set makepef_name '{MAKEPEF_NULL}'
  130.     Set rez_name '{REZ_68K}'
  131. Else If "{host_cc}" =~ /ppcc/
  132.     Set cc_name '{CC_PPCC}'
  133.     Set segment_flag ''
  134.     Set ar_name '{AR_PPCLINK}'
  135.     Set ranlib_name '{RANLIB_NULL}'
  136.     Set cc_ld_name '{CC_LD_PPCLINK}'
  137.     Set prog_ext_name '{PROG_EXT_XCOFF}'
  138.     Set extralibs_name '{EXTRALIBS_PPC}'
  139.     Set makepef_name '{MAKEPEF_PPC}'
  140.     Set rez_name '{REZ_PPC}'
  141. Else If "{host_cc}" =~ /mrc/
  142.     Set cc_name '{CC_MRC}'
  143.     Set segment_flag ''
  144.     Set ar_name '{AR_PPCLINK}'
  145.     Set ranlib_name '{RANLIB_NULL}'
  146.     Set cc_ld_name '{CC_LD_PPCLINK}'
  147.     Set prog_ext_name '{PROG_EXT_XCOFF}'
  148.     Set extralibs_name '{EXTRALIBS_PPC}'
  149.     Set makepef_name '{MAKEPEF_PPC}'
  150.     Set rez_name '{REZ_PPC}'
  151. Else If "{host_cc}" =~ /sc/
  152.     Set cc_name '{CC_SC}'
  153.     Set segment_flag ''
  154.     Set ar_name '{AR_PPCLINK}'
  155.     Set ranlib_name '{RANLIB_NULL}'
  156.     Set cc_ld_name '{CC_LD_PPCLINK}'
  157.     Set prog_ext_name '{PROG_EXT_XCOFF}'
  158.     Set extralibs_name '{EXTRALIBS_PPC}'
  159.     Set makepef_name '{MAKEPEF_PPC}'
  160.     Set rez_name '{REZ_PPC}'
  161. Else If "{host_cc}" =~ /mwcppc/
  162.     Set cc_name '{CC_MWCPPC}'
  163.     Set segment_flag ''
  164.     Set ar_name '{AR_MWLINKPPC}'
  165.     Set ranlib_name '{RANLIB_NULL}'
  166.     Set cc_ld_name '{CC_LD_MWLINKPPC}'
  167.     # Misleading, but we don't need a PEF step.
  168.     Set prog_ext_name '{PROG_EXT_68K}'
  169.     Set extralibs_name '{EXTRALIBS_MWCPPC}'
  170.     Set makepef_name '{MAKEPEF_NULL}'
  171.     Set rez_name '{REZ_PPC}'
  172. Else If "{host_cc}" =~ /ppc-gcc/
  173.     Set cc_name '{CC_PPC_GCC}'
  174.     Set segment_flag ''
  175.     Set ar_name '{AR_PPCLINK}'
  176.     Set ranlib_name '{RANLIB_RANLIB}'
  177.     Set cc_ld_name '{CC_LD_PPCLINK}'
  178.     Set prog_ext_name '{PROG_EXT_XCOFF}'
  179.     Set extralibs_name '{EXTRALIBS_PPC}'
  180.     Set makepef_name '{MAKEPEF_PPC}'
  181.     Set rez_name '{REZ_PPC}'
  182. Else
  183.     Echo "{host_cc}" is not a known MPW C compiler type
  184. End If
  185.  
  186. Set configdirs ""
  187.  
  188. If "{srcroot}" =~ /--------/
  189.     Set srcroot "{srcdir}"
  190. End If
  191. If "`Exists "{srcdir}"`" == ""
  192.     Echo Source directory {srcdir} does not exist!
  193.     Exit 1
  194. End If
  195. If "`Exists "{srcroot}"`" == ""
  196.     Echo Top-level source directory {srcroot} does not exist!
  197.     Exit 1
  198. End If
  199.  
  200. Set target_cpu "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`"
  201. Set target_vendor "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`"
  202. Set target_os "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`"
  203.  
  204. # Create a file that is guaranteed to be older than any other here.
  205.  
  206. If "`Exists "{objdir}"_oldest`" == ""
  207.     mpw-touch _oldest
  208. End If
  209.  
  210. # Record this before creating any files, makefiles sometimes mention
  211. # dependencies on config.status.
  212.  
  213. Echo "# This directory was configured as follows:" >config.new
  214. Echo "{ThisScript} --host {host_alias} --target {target_alias} --srcdir {srcdir}  --srcroot {srcroot}  --prefix {prefix} --cc {host_cc}" >>config.new
  215. MoveIfChange config.new config.status
  216.  
  217. If "`Exists "{srcdir}"mpw-config.in`" != ""
  218.     tr-7to8 "{srcdir}"mpw-config.in >"{objdir}"mpw-config.in
  219.     Execute "{objdir}"mpw-config.in
  220. End If
  221.  
  222. # Start Makefile construction by defining all the variables chosen by
  223. # configuration.
  224.  
  225. Echo "# This Makefile produced by mpw-configure.  Changes may get lost!" > "{objdir}"Makefile.tem
  226. Echo "srcroot = " {srcroot}            >> "{objdir}"Makefile.tem
  227. Echo "topsrcdir = " {srcroot}            >> "{objdir}"Makefile.tem
  228. Echo "srcdir = " {srcdir}            >> "{objdir}"Makefile.tem
  229. Echo "mpw_prefix = " {prefix}            >> "{objdir}"Makefile.tem
  230. Echo "host_alias = " {host_alias}        >> "{objdir}"Makefile.tem
  231. Echo "target_alias = " {target_alias}        >> "{objdir}"Makefile.tem
  232. Echo "target_cpu = " {target_cpu}        >> "{objdir}"Makefile.tem
  233. Echo "target_vendor = " {target_vendor}        >> "{objdir}"Makefile.tem
  234. Echo "target_os = " {target_os}            >> "{objdir}"Makefile.tem
  235. Echo "target_canonical = " {target_canonical}    >> "{objdir}"Makefile.tem
  236. Echo "host_makefile_frag = "            >> "{objdir}"Makefile.tem
  237. Echo "target_makefile_frag = "            >> "{objdir}"Makefile.tem
  238. Echo "CC = " {cc_name}                >> "{objdir}"Makefile.tem
  239. Echo "AR = " {ar_name}                >> "{objdir}"Makefile.tem
  240. Echo "RANLIB = " {ranlib_name}            >> "{objdir}"Makefile.tem
  241. Echo "CC_LD = " {cc_ld_name}            >> "{objdir}"Makefile.tem
  242. Echo "PROG_EXT = " {prog_ext_name}        >> "{objdir}"Makefile.tem
  243. Echo "EXTRALIBS = " {extralibs_name}        >> "{objdir}"Makefile.tem
  244. Echo "MAKEPEF = " {makepef_name}        >> "{objdir}"Makefile.tem
  245. Echo "REZ = " {rez_name}            >> "{objdir}"Makefile.tem
  246.  
  247. # Append the master set of definitions for the various compilers.
  248.  
  249. If "`Exists "{srcdir}"config:mpw-mh-mpw`" != ""
  250.     tr-7to8 "{srcdir}"config:mpw-mh-mpw >>"{objdir}"Makefile.tem
  251. Else If "`Exists "{srcroot}"config:mpw-mh-mpw`" != ""
  252.     tr-7to8 "{srcroot}"config:mpw-mh-mpw >>"{objdir}"Makefile.tem
  253. Else
  254.     Echo "Can't find a host config file, continuing without it"
  255. End If
  256.  
  257. # Append anything produced by the directory's mpw-config.in.
  258.  
  259. If "`Exists "{objdir}"mk.tmp`" != ""
  260.     Catenate "{objdir}"mk.tmp >>"{objdir}"Makefile.tem
  261.     # An mpw-config.in might change so as not to create this
  262.     # anymore, so get rid of it now to be safe.
  263.     Delete -i -y "{objdir}"mk.tmp
  264. End If
  265.  
  266. # If there is a sed script to edit the Unix Makefile.in, use it; otherwise
  267. # use an mpw-make.in if present.
  268.  
  269. If "`Exists "{srcdir}"mpw-make.sed`" != ""
  270.     sed -f "{srcroot}"utils:mpw:u2mpw-mf.sed "{srcdir}"Makefile.in >"{objdir}"Makefile.tem1
  271.     sed -f "{srcdir}"mpw-make.sed "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2
  272.     sed -e "s/@SEGMENT_FLAG@/{segment_flag}/" "{objdir}"Makefile.tem2 >"{objdir}"mpw-make.in
  273.     tr-7to8 "{objdir}"mpw-make.in >>"{objdir}"Makefile.tem
  274.     MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile
  275.     Delete -i -y "{objdir}"Makefile.tem[12]
  276.     If {verify} == 1
  277.         Echo Created Makefile in "`Directory`"
  278.     End If
  279. Else If "`Exists "{srcdir}"mpw-make.in`" != ""
  280.     sed -e 's/^prefix = .*$/prefix = {mpw_prefix}/g' "{srcdir}"mpw-make.in >"{objdir}"Makefile.tem1
  281.     sed -e "s/@SEGMENT_FLAG@/{segment_flag}/" "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2
  282.     tr-7to8 "{objdir}"Makefile.tem2 >>"{objdir}"Makefile.tem
  283.     MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile
  284.     Delete -i -y "{objdir}"Makefile.tem[12]
  285.     If {verify} == 1
  286.         Echo Created Makefile in "`Directory`"
  287.     End If
  288. End If
  289.  
  290. # Produce a build script if the source is defined.
  291.  
  292. If "`Exists "{srcdir}"mpw-build.in`" != ""
  293.     Echo "Set srcroot " {srcroot} > "{objdir}"mpw-build.tem
  294.     Echo "Set srcdir " {srcdir} >> "{objdir}"mpw-build.tem
  295.     Echo "Set target_canonical " {target_canonical} >> "{objdir}"mpw-build.tem
  296.     Echo "Set prefix " {prefix} >> "{objdir}"mpw-build.tem
  297.     tr-7to8 "{srcdir}"mpw-build.in >>"{objdir}"mpw-build.tem
  298.     MoveIfChange "{objdir}"mpw-build.tem "{objdir}"mpw-build
  299.     If {verify} == 1
  300.         Echo Created mpw-build in "`Directory`"
  301.     End If
  302. End If
  303.  
  304. For subdir In {configdirs}
  305.     Set savedir "`Directory`"
  306.     If "`Exists "{srcdir}{subdir}:"`" == ""
  307.         Echo Strange, no {subdir} in {srcdir}
  308.         Continue
  309.     End If
  310.     If {verify} == 1
  311.         Echo Configuring {subdir}...
  312.     End If
  313.     If "`Exists "{objdir}{subdir}:"`" == ""
  314.         NewFolder "{objdir}{subdir}"
  315.     End If
  316.     SetDirectory "{objdir}{subdir}:"
  317.     "{ThisScript}" --target "{target_canonical}" --srcdir "{srcdir}{subdir}:" --srcroot "{srcroot}" --prefix "{prefix}" --cc "{host_cc}" {verifystr}
  318.     SetDirectory "{savedir}"
  319. End For
  320.  
  321. SetDirectory "{savedir}"
  322.